/****************************************************************************

Force Engine v0.5

Creado: 28/03/08
Clase: Mesh.h
Hecho by: German Battiston AKA Melkor

Modificado: 18/08/08

****************************************************************************/

//---------------------------------------------------------------------------
#ifndef MESH_H
#define MESH_H
//---------------------------------------------------------------------------
#include "../Entity3D/Entity3D.h"
#include "../IndexBuffer/IndexBuffer.h"
#include "../VertexBuffer/VertexBuffer.h"
#include "../Material/Material.h"
#include "../Entity3D/BVH.h"
//---------------------------------------------------------------------------
class Graphics;
class XMeshImporter;
class GraphicsStructs;
//---------------------------------------------------------------------------
class FORCEENGINE_API Mesh : public Entity3D
{
public:
	
	Mesh(Graphics &rkGraphics);
	~Mesh();

	void Draw();
	bool Initialize(Graphics &rkGraphics);
	void DeInitialize();

	bool LoadMesh(std::string szFileName);

	void SetIndices(short * aCubeIndices);
	void SetVertices(MeshVertex * aCubeVertices);
	void SetMaterial(Material * pkMaterial);

	const D3DXVECTOR3* GetBVHVertices();

// overrides //--------------------------------------------------------------
	void TransFormByMatrix(D3DXMATRIX * pkD3DXMatrix);
// overrides //--------------------------------------------------------------

	short uiIdxCount;
	short uiVtxCount;

private:

	short * m_aCubeIndices;
	MeshVertex * m_aCubeVertices;

	Material * m_pkMaterial;

	IndexBuffer * m_pIndexBuffer;
	VertexBuffer <MeshVertex, D3DFVF_MESHVERTEX> * m_pVertexBuffer;

	XMeshImporter * m_pkImporter;

	LPDIRECT3DDEVICE9 m_pkDevice;

	BVH * m_pkBoundingVolume;

	friend class XMeshImporter;
};
//---------------------------------------------------------------------------

#endif /*--- MESH_H ---*/

//---------------------------------------------------------------------------